package com.travelsmart.client.apresentacao.widget;

import com.google.gwt.user.client.ui.TextBox;



public class FormTextBox extends FormWidget<String>{
	
	private TextBox textBox;
	
	
	public FormTextBox(String name, String infoHelp){
		this(name, infoHelp, null);
	}
	
	public FormTextBox(String name, String infoHelp, final HandlerValidation<String> handler){
		super(handler);
		this.textBox = new TextBox();
		this.textBox.setTitle(infoHelp);
		this.textBox.setName(name);
		super.panel.add(textBox);
		super.initHelp(infoHelp);
		initWidget(panel);
	}
	
	
	public FormTextBox(String name, String infoHelp, int length, final HandlerValidation<String> handler){
		this(name, infoHelp, handler);
		textBox.setMaxLength(length);
	}

	public void setValue(String valor){
		textBox.setValue(valor);
	}

	public String getValue(){
		return textBox.getValue();
	}

	@Override
	public void setFocus(boolean focused) {
		textBox.setFocus(focused);
		
	}
	
	
}
	
